//
//  PurchaseDetailHeader.swift
//  SlaughterClient
//
//  Created by 邱仙凯 on 2021/8/31.
//  Copyright © 2021 zwb. All rights reserved.
//

import UIKit
 
class ZyaPurchaseDetailHeader: UIView {
    
    var model = ZyaClientAddress(JSON:["":""])! {
        didSet {
            self.nameItem.setVal(model.kLinkName.unwrap)
             self.proItem.setVal(model.kProvince.unwrap + model.kCity.unwrap + model.kArea.unwrap)
            self.addrItem.setVal(model.clientAdd.unwrap)
            self.defaultItem.setSwitchOn(model.currMark == 1 ? true : false)
        }
    }
     var bg :UIView = {
        let v = UIView()
        v.backgroundColor = .white
        v.layer.cornerRadius = 5
        return v
    }()
    
    var nameItem :KSFormHItem = {
        let v = KSFormHItem(title: "提货日期")
        return v
    }()
  
    var proItem :KSFormHItem = {
        let v = KSFormHItem(title: "收货地址", type: .tempTextView)
        return v
    }()
    var defaultItem :KSSwitchItem = {
        let appe = KSFormHAppear()
        let v = KSSwitchItem(title: "使用预付款支付",appearance:appe)
        return v
    }()
    var addrItem :KSFormHItem = {
        let v = KSFormHItem(title: "备注")
        return v
    }()
   

    override init(frame: CGRect) {
        super.init(frame: frame)
      
         self.backgroundColor = Theme.awModuleBgColor
       
        self.addSubview(bg)
        bg.snp.makeConstraints { make in
            make.left.equalTo(self).offset(6)
            make.right.equalTo(self).offset(-6)
            make.top.equalTo(self).offset(10)
        }
        bg.addSubview(nameItem)
        nameItem.snp.makeConstraints { make in
            make.left.right.top.equalTo(bg)
            make.height.equalTo(43)
        }
   
        bg.addSubview(proItem)
        proItem.snp.makeConstraints { make in
            make.left.right.equalTo(bg)
            make.top.equalTo(nameItem.snp.bottom)
            make.height.equalTo(65)
        }
        bg.addSubview(defaultItem)
        defaultItem.snp.makeConstraints { make in
            make.left.right.equalTo(bg)
            make.top.equalTo(proItem.snp.bottom)
            make.height.equalTo(43)
         }
        bg.addSubview(addrItem)
        addrItem.snp.makeConstraints { make in
            make.left.right.equalTo(bg)
            make.top.equalTo(defaultItem.snp.bottom)
            make.height.equalTo(43)
            make.bottom.equalTo(bg)
         }
      
     }
  
    required init?(coder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
   
  
}
